Replace _FillValue by NC_FillValue for NetCDF 4.9.3.
authorBas Couwenberg <sebastic@debian.org>
Sat, 15 Feb 2025 13:13:19 +0000 (13:13 +0000)
committerBastian Germann <bage@debian.org>
Sat, 15 Feb 2025 13:13:19 +0000 (13:13 +0000)
Gbp-Pq: Name netcdf-4.9.3.patch

IO/MINC/vtkMINC.h
IO/NetCDF/vtkNetCDFCFWriter.cxx
IO/NetCDF/vtkNetCDFReader.cxx
IO/NetCDF/vtkNetCDFReader.h
IO/NetCDF/vtkNetCDFUGRIDReader.cxx
IO/NetCDF/vtkNetCDFUGRIDReader.h
ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c
ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c

index 8b33066e80cec251bbadae263472b2183ae90c2d..e09abdf2167bc11f6e7ff7dc736f99b6035add35 100644 (file)
@@ -178,7 +178,7 @@ use it.
 #define MIvalid_range "valid_range"
 #define MIvalid_max "valid_max"
 #define MIvalid_min "valid_min"
-#define MI_FillValue "_FillValue"
+#define MI_FillValue "NC_FillValue"
 #define MItitle "title"
 #define MIhistory "history"
 
index 659d7b6cf86adf1cc1329b3fc6effd68a6170ba7..ae9d5198d3f94904cca503f2816525d93d31a646 100644 (file)
@@ -442,7 +442,7 @@ public:
     status = NC_NOERR;
     if (std::string(arrayName).rfind("vtk", 0) > 0)
     {
-      // for an array that starts with vtk we don't specify _FillValue
+      // for an array that starts with vtk we don't specify NC_FillValue
       switch (vtkType)
       {
         case VTK_CHAR:
@@ -451,34 +451,34 @@ public:
           if (fillValue != NC_FILL_INT)
           {
             unsigned char fillByte = fillValue;
-            status = nc_put_att(ncid, attributeid, "_FillValue", NC_BYTE, 1, &fillByte);
+            status = nc_put_att(ncid, attributeid, "NC_FillValue", NC_BYTE, 1, &fillByte);
           }
           break;
         case VTK_SHORT:
           if (fillValue != NC_FILL_SHORT)
           {
             short fillShort = fillValue;
-            status = nc_put_att_short(ncid, attributeid, "_FillValue", NC_SHORT, 1, &fillShort);
+            status = nc_put_att_short(ncid, attributeid, "NC_FillValue", NC_SHORT, 1, &fillShort);
           }
           break;
         case VTK_INT:
           if (fillValue != NC_FILL_INT)
           {
-            status = nc_put_att_int(ncid, attributeid, "_FillValue", NC_INT, 1, &fillValue);
+            status = nc_put_att_int(ncid, attributeid, "NC_FillValue", NC_INT, 1, &fillValue);
           }
           break;
         case VTK_FLOAT:
           if (fillValue != NC_FILL_INT)
           {
             float fillFloat = fillValue;
-            status = nc_put_att_float(ncid, attributeid, "_FillValue", NC_FLOAT, 1, &fillFloat);
+            status = nc_put_att_float(ncid, attributeid, "NC_FillValue", NC_FLOAT, 1, &fillFloat);
           }
           break;
         case VTK_DOUBLE:
           if (fillValue != NC_FILL_INT)
           {
             double fillDouble = fillValue;
-            status = nc_put_att_double(ncid, attributeid, "_FillValue", NC_DOUBLE, 1, &fillDouble);
+            status = nc_put_att_double(ncid, attributeid, "NC_FillValue", NC_DOUBLE, 1, &fillDouble);
           }
           break;
         default:
@@ -489,7 +489,7 @@ public:
       if (status)
       {
         std::ostringstream ostr;
-        ostr << "Error nc_put_att_xxx " << arrayName << ":_FillValue: " << nc_strerror(status);
+        ostr << "Error nc_put_att_xxx " << arrayName << ":NC_FillValue: " << nc_strerror(status);
         throw std::runtime_error(ostr.str());
       }
     }
index aa47707c8c2cad642f7eb42206a33e16dc7096e6..d9a44aa8e93b8cfc1eeec331fd6b24b8609cced2 100644 (file)
@@ -867,7 +867,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt
 
   // Check for a fill value.
   size_t attribLength;
-  if ((nc_inq_attlen(ncFD, varId, "_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1))
+  if ((nc_inq_attlen(ncFD, varId, "NC_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1))
   {
     if (this->ReplaceFillValueWithNan)
     {
@@ -875,7 +875,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt
       if (dataArray->GetDataType() == VTK_FLOAT)
       {
         float fillValue;
-        nc_get_att_float(ncFD, varId, "_FillValue", &fillValue);
+        nc_get_att_float(ncFD, varId, "NC_FillValue", &fillValue);
         std::replace(reinterpret_cast<float*>(dataArray->GetVoidPointer(0)),
           reinterpret_cast<float*>(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())),
           fillValue, static_cast<float>(vtkMath::Nan()));
@@ -883,7 +883,7 @@ int vtkNetCDFReader::LoadVariable(int ncFD, const char* varName, double time, vt
       else if (dataArray->GetDataType() == VTK_DOUBLE)
       {
         double fillValue;
-        nc_get_att_double(ncFD, varId, "_FillValue", &fillValue);
+        nc_get_att_double(ncFD, varId, "NC_FillValue", &fillValue);
         std::replace(reinterpret_cast<double*>(dataArray->GetVoidPointer(0)),
           reinterpret_cast<double*>(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())),
           fillValue, vtkMath::Nan());
index fedf0fb3492310a7be16a2c9a51c83873da68bc8..4feeaa9ac730b5c572422f70f6ff993428d7751b 100644 (file)
@@ -107,7 +107,7 @@ public:
 
   ///@{
   /**
-   * If on, any float or double variable read that has a _FillValue attribute
+   * If on, any float or double variable read that has a NC_FillValue attribute
    * will have that fill value replaced with a not-a-number (NaN) value.  The
    * advantage of setting these to NaN values is that, if implemented properly
    * by the system and careful math operations are used, they can implicitly be
index 5b96d6438e234ac7bdffce979e87e8267cfd40fb..1b2c53ad2eb6192861869ca83548a74e1eeb395c 100644 (file)
@@ -508,10 +508,10 @@ bool vtkNetCDFUGRIDReader::ParseHeader()
   if (this->NodesPerFace > 3) // may be mixed mesh
   {
     if (!this->CheckError(
-          nc_get_att(this->NcId, this->FaceVarId, "_FillValue", &this->FaceFillValue)))
+          nc_get_att(this->NcId, this->FaceVarId, "NC_FillValue", &this->FaceFillValue)))
     {
-      vtkErrorMacro("_FillValue attribute missing - The connectivity variable has to specify a "
-                    "_FillValue attribute because it has more than 3 nodes per face");
+      vtkErrorMacro("NC_FillValue attribute missing - The connectivity variable has to specify a "
+                    "NC_FillValue attribute because it has more than 3 nodes per face");
       return false;
     }
   }
@@ -859,7 +859,7 @@ struct DataArrayExtractor
     if (replaceFill && (std::is_same<T, float>::value || std::is_same<T, double>::value))
     {
       T fillValue{};
-      if (nc_get_att(NcId, var, "_FillValue", &fillValue) != NC_NOERR)
+      if (nc_get_att(NcId, var, "NC_FillValue", &fillValue) != NC_NOERR)
       {
         vtkDebugWithObjectMacro(output, "No fill value defined");
         return;
index 7997370c6f8ab5965908a6f84af7df1d7dce3eee..99559b863a9d11026e0a493467ff27ffb34ca2a6 100644 (file)
@@ -76,7 +76,7 @@ public:
 
   ///@{
   /**
-   * If on, any float or double variable read that has a _FillValue attribute
+   * If on, any float or double variable read that has a NC_FillValue attribute
    * will have that fill value replaced with a not-a-number (NaN) value.  The
    * advantage of setting these to NaN values is that, if implemented properly
    * by the system and careful math operations are used, they can implicitly be
index 2b661d31425d01dfa886f474ac23f7371225da8a..69b5ed29814fde204d7053c3473ee829adf39024 100644 (file)
@@ -243,7 +243,7 @@ int ex_put_prop(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const c
     vals[0] = 0; /* fill value */
     /*   create attribute to cause variable to fill with zeros per routine spec
      */
-    if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) {
+    if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) {
       snprintf(errmsg, MAX_ERR_LENGTH,
                "ERROR: failed to create property name fill attribute in file id %d", exoid);
       ex_err_fn(exoid, __func__, errmsg, status);
index 9d2223dc119be2fe45d8586dd46ab994b18c31cc..98caea5a99611e0b3ceac66f93918e09858d3211 100644 (file)
@@ -172,7 +172,7 @@ int ex_put_prop_names(int exoid, ex_entity_type obj_type, int num_props, char **
 
     /*   create attribute to cause variable to fill with zeros per routine spec
      */
-    if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) {
+    if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) {
       snprintf(errmsg, MAX_ERR_LENGTH,
                "ERROR: failed to create property name fill attribute in file id %d", exoid);
       ex_err_fn(exoid, __func__, errmsg, status);